package com.example.radio;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    private LinearLayout LinearLayout1;
    private RadioGroup radioGroup;
    private RadioButton idSex,btnMan,btnWoman;
    private TextView idTvShow;
    private Button btnpost;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        LinearLayout1 = findViewById(R.id.LinearLayout1);
        radioGroup = findViewById(R.id.radioGroup);
        btnMan = findViewById(R.id.btnMan);
        idTvShow = findViewById(R.id.idTvShow);
      /*  btnWoman = findViewById(R.id.btnWoman);
        btnpost = findViewById(R.id.btnpost);*/

        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                idSex = findViewById(i);
                idTvShow.setText(idSex.getText().toString());
                Toast.makeText(MainActivity.this, "你是" + idSex.getText() + "的", Toast.LENGTH_SHORT).show();
            }
        });

    }
}